package com.zhuiyun.project.api.memberUserManagement.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhuiyun.project.api.caseImage.entity.CaseImage;
import com.zhuiyun.project.api.coachmanagement.entity.CoachManagement;
import com.zhuiyun.project.api.coachmanagement.model.CoachUpNotesModel;
import com.zhuiyun.project.api.memberTypeManagement.entity.MemberCardNumber;
import com.zhuiyun.project.api.memberTypeManagement.model.MemberTypeManagementModel;
import com.zhuiyun.project.api.memberUserManagement.entity.MemberUserManagement;
import com.zhuiyun.project.api.memberUserManagement.model.MemberUserAndTypeModel;
import com.zhuiyun.project.api.memberUserManagement.model.MemberUserModel;
import com.zhuiyun.project.api.memberUserManagement.model.MemberUserRecord;
import com.zhuiyun.project.api.studentTraining.model.MemberUserInfoModel;
import com.zhuiyun.project.common.response.CommonResult;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @InterfaceName MemberUserManagementMapper
 * @Description TODO 会员用户管理持久层接口
 * @Author WX
 * @Date 2023/11/3 8:38
 **/
@Mapper
public interface MemberUserManagementMapper extends BaseMapper<MemberUserManagement> {
    /**
     * @Author WX
     * @Description 获取会员用户信息
     * @Date 2023/11/3 10:15
     * @Return
     * @param memberUserModel
     */
    List<MemberUserAndTypeModel> getMemberType(MemberUserModel memberUserModel);

    /**
    * @Author wx
    * @Description 通过手机号查询用户信息
    * @Date 2023/11/6 11:28
    * @Return
    * @param memberUserAndTypeModel
    */
    List<MemberUserManagement> selectByPhone(MemberUserAndTypeModel memberUserAndTypeModel);
    /**
     * @Author wx
     * @Description 通过手机号查询用户信息
     * @Date 2023/11/6 11:28
     * @Return
     * @param
     */
    List<MemberUserManagement> selectByPhoneOnly(String phone);
    /**
    * @Author wx
    * @Description 添加新会员
    * @Date 2023/11/6 13:38
    * @Return
    * @param memberUserAndTypeModel
    */
    int addMemberUser(MemberUserAndTypeModel memberUserAndTypeModel);

    /**
     * @Author wx
     * @Description 根据id查询单个会员的数据
     * @Date 2023/11/7 8:29
     * @Return
     * @param id
     */
    MemberUserAndTypeModel getById(Integer id,String venueUniqueIdentifier);

    /**
     * @Author wx
     * @Description 根据id修改单个会员的数据
     * @Date 2023/11/7 8:29
     * @Return
     * @param memberUserAndTypeModel
     */
    int updateMemberUser(MemberUserAndTypeModel memberUserAndTypeModel);

    /**
    * @Author wx
    * @Description 根据会员卡号查询用户数据
    * @Date 2023/11/14 9:19
    * @Return
    * @param membershipCardNumber
    */
    MemberUserAndTypeModel getByMembershipCardNumber(String venueUniqueIdentifier, String membershipCardNumber);

    /**
    * @Author wx
    * @Description 查询用户体重记录
    * @Date 2023/11/21 9:13
    * @Return
    * @param venueUniqueIdentifier
    */
    MemberUserManagement getStudentTrainingWeight(Integer id, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 小程序端查询会员用户信息
    * @Date 2023/11/28 10:20
    * @Return
    * @param venueUniqueIdentifier
    */
    MemberUserInfoModel getUserInformation(Integer id, String venueUniqueIdentifier);

    /**
     * @Author wx
     * @Description 根据邀请码查询教练的数据
     * @Date 2023/11/7 8:29
     * @Return
     * @param invitationCode
     */
    CoachManagement getByInvitationCode(String invitationCode, String venueUniqueIdentifier);

    /**
     * @Author wx
     * @Description 刷卡确认后条件判断删除任务
     * @Date 2023/12/3 18:51
     * @Return
     * @param venueUniqueIdentifier,memberUserPhone
     */
    MemberUserManagement selectByMemberUserPhone(String memberUserPhone, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 减去一次刷卡次数
    * @Date 2023/12/3 19:08
    * @Return
    * @param id
    */
    int deleteByMemberUserPhone(Integer id);



    /**
     * @Author wx
     * @Description 添加用户教练
     * @Date 2023/12/3 19:08
     * @Return
     * @param memberUserId
     */
    int addByInvitationCode(String coachCode,Integer memberUserId );

    /**
     * @Author wx
     * @Description 根据用户ID查询单教练的数据
     * @Date 2023/12/4 10:19
     * @Return
     * @param venueUniqueIdentifier
     */
    MemberUserManagement selectCoachByUserId(Integer id, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 通过memberId查询用户数据
    * @Date 2023/12/4 14:54
    * @Return
    * @param memberId
    */
    MemberUserManagement selectByMemberId(Integer memberId);

    /**
     * @Author wx
     * @Description 查看该会员类型下是否有会员数据
     * @Date 2023/12/7 9:54
     * @Return
     * @param memberTypeId
     */
    int getByMemberTypeId(Integer memberTypeId, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 根据卡号查询刷卡记录
    * @Date 2023/12/10 20:01
    * @Return
    * @param membershipCardNumber
    */
    MemberCardNumber selectCardNumberByCard(String membershipCardNumber, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 添加角色刷卡记录
    * @Date 2023/12/10 20:06
    * @Return
    * @param membershipCardNumber
    */
    int addMemberCardNumber(String membershipCardNumber, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 是今天的话就直接添加次数
    * @Date 2023/12/10 20:17
    * @Return
    * @param membershipCardNumber
    */
    int addMemberCardNumberToday(String membershipCardNumber, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 不是今天的话改为当前时间并重置次数
    * @Date 2023/12/10 20:18
    * @Return
    * @param membershipCardNumber
    */
    int updateMemberCardNumberToday(String membershipCardNumber, String venueUniqueIdentifier);

    /**
    * @Author wx
    * @Description 查询今日刷卡次数
    * @Date 2023/12/10 20:23
    * @Return
    * @param membershipCardNumber
    */
    MemberCardNumber selectCardNumberByToday(String venueUniqueIdentifier, String membershipCardNumber);

    /**
     * @Author wx
     * @Description 教练端查询会员信息
     * @Date 2023/12/12 9:57
     * @Return
     * @param id
     */
    MemberUserRecord selectUserCase(String venueUniqueIdentifier, Integer id, String coachId);

    /**
    * @Author wx
    * @Description 查询案例创建时间
    * @Date 2023/12/12 10:28
    * @Return
    * @param id,coachId
    */
    List<CaseImage> selectUserInfoTime(Integer id, Integer coachId);
    /**
     * @Author wx
     * @Description 查询入会人数
     * @Date 2023/12/27 20:33
     * @Return
     * @param venueUniqueIdentifier
     */
    List<MemberUserManagement> selectOnlineStatuss(String venueUniqueIdentifier);

    /**
    * @Author 胡家浩
    * @Description 查询当天入场人数
    * @Date 2024/5/16 16:26
    * @Return java.util.List<com.zhuiyun.project.api.memberTypeManagement.entity.MemberCardNumber>
    * @param venueUniqueIdentifier
* @param currentDate
    */
    List<MemberCardNumber> selectEntranceNumber (String venueUniqueIdentifier,String currentDate);

    /**
    * @Author 胡家浩
    * @Description 会员刷卡入场
    * @Date 2024/5/16 20:27
    * @Return int
    * @param memberCardNumber
    */
    int userEntranceInsert (MemberCardNumber memberCardNumber);

    /**
    * @Author 胡家浩
    * @Description 会员多次刷卡 （更新刷卡时间）
    * @Date 2024/5/16 20:31
    * @Return int
    * @param memberCardNumber
    */
    int userDepartureUpdate (MemberCardNumber memberCardNumber);

    /**
    * @Author 胡家浩
    * @Description 根据卡号查询该用户当天是否入场
    * @Date 2024/5/17 10:20
    * @Return java.util.List<com.zhuiyun.project.api.memberTypeManagement.entity.MemberCardNumber>
    * @param venueUniqueIdentifier
    * @param membershipCardNumber
    * @param updateTime
    */
    List<MemberCardNumber> userIfEntrance (String venueUniqueIdentifier,String membershipCardNumber,String updateTime);

    /**
    * @Author 胡家浩
    * @Description 查询用户会员卡类型
    * @Date 2024/5/17 15:06
    * @Return com.zhuiyun.project.api.memberUserManagement.model.MemberUserAndTypeModel
    * @param venueUniqueIdentifier
* @param membershipCardNumber
    */
    MemberUserAndTypeModel selectUserMemberType (String venueUniqueIdentifier,String membershipCardNumber);

    /**
     * @Author wx
     * @Description 会员离场
     * @Date 2023/12/28 8:16
     * @Return
     * @param id
     */
    int outVenuById(String venueUniqueIdentifier, Integer id);

    /**
    * @Author wx
    * @Description 入场次数加一
    * @Date 2023/12/28 8:45
    * @Return
    * @param id
    */
    int addOnlineTimes(String venueUniqueIdentifier, Integer id);

    MemberUserManagement selectMemberByPhone(String phone);

    void insertMemberUser(MemberUserManagement m);

    int updateMemberInfoById(MemberUserAndTypeModel memberUserAndTypeModel);

    int coachUpNotes(CoachUpNotesModel coachUpNotesModel);

    void deleteNotesById(Integer id);


    CoachManagement selectIdByCode(String coachCode);

    void UpdateUserRecordById(Integer memberUserId, String coachCode);

    /**
    * @Author 胡家浩
    * @Description 统计会员入场的次数
    * @Date 2024/5/20 14:27
    * @Return java.util.List<com.zhuiyun.project.api.memberTypeManagement.model.MemberTypeManagementModel>
    * @param venueUniqueIdentifier
    * @param year
    * @param month
    * @param week
    */
    List<MemberTypeManagementModel> getMemberEntranceTimes (String venueUniqueIdentifier,String year,String month,String week);

    /**
    * @Author 胡家浩
    * @Description 统计会员办卡情况(根据日期)
    * @Date 2024/5/21 15:53
    * @Return java.util.List<com.zhuiyun.project.api.memberTypeManagement.model.MemberTypeManagementModel>
    * @param venueUniqueIdentifier
    * @param year
    * @param month
    * @param week
    */
    List<MemberTypeManagementModel> getMemberUserCardDate (String venueUniqueIdentifier,String year,String month,String week);

}
